import 'package:flutter/material.dart';

class CounterWidget extends StatefulWidget {
	const CounterWidget({Key key, this.initValue});

	final int initValue;

	@override
	_CounterWidgetState createState() => new _CounterWidgetState();
}

class _CounterWidgetState extends State<CounterWidget> {
	bool _active = false;

	@override
	void initState() {
		super.initState();
		print("initState");
	}

	void _handelTap() {
		setState(() {
			_active = !_active;
		});
	}

	@override
	Widget build(BuildContext context) {
		return new GestureDetector(
			onTap: _handelTap,
			child: new Container(
				child: new Center(
					child: new Text(
						_active ? 'Active' : 'Inactive',
						style: new TextStyle(fontSize: 32.0, color: Colors.white),
					),
				),
				width: 200.0,
				height: 200.0,
				decoration: new BoxDecoration(
					color: _active ? Colors.lightGreen[700] : Colors.grey[600],
				),
			),
		);
	}

}